<?php 
	session_start();
	
	$id=$_POST[id];
	$pw=$_POST[pw];
	
	include "connect.php";
				
	$query="SELECT * FROM member WHERE id='$id' AND pw='$pw'";
	$result=mysql_query($query);
	//if(!mysql_query($query,$connect)) die('Error: '. mysql_error());
	$num=mysql_num_rows($result);
	
	
	if($num){
		$row=mysql_fetch_array($result);
		
		$_SESSION['login']='YES';
		$_SESSION['id']=$row[id];
		$_SESSION['nick']=$row[nick];
		$_SESSION['college']=$row[college];
		$_SESSION['dept']=$row[dept];
	}
	else{
		$_SESSION['login']='NO';
		$_SESSION['id']='';
		$_SESSION['nick']='';
		$_SESSION['college']='';
		$_SESSION['dept']='';
	}
	
	header("Location: exam.php");
	exit;
?>